importClass(java.util.HashSet);
importClass(java.util.List);
importClass(java.util.Map);
importClass(java.util.ArrayList);
importClass(org.bukkit.configuration.file.YamlConfiguration);
importPackage(Packages.org.bukkit);
importPackage(Packages.java.io);
importPackage(Packages.java.awt);
importPackage(Packages.javax.imageio);
importPackage(Packages.com.sk89q.worldedit);
importPackage(Packages.com.sk89q.worldedit.schematic);
importPackage(Packages.com.sk89q.worldedit.blocks);
importPackage(Packages.com.sk89q.worldguard.bukkit);
importPackage(Packages.com.sk89q.worldguard.bukkit.commands);

var sess = context.remember();
var dir = new File("plugins/Essentials/userdata");
var files = dir.listFiles();
var formatter = new java.text.SimpleDateFormat("dd-MM-yyyy")
var mindate = formatter.parse("22-04-2014");
player.print(mindate);
var liveplayers = new PrintWriter(new FileWriter("liveplayers.txt"));

for(var i=0; i<files.length; i++){
  file = files[i];
  islive = true;
  var y = YamlConfiguration.loadConfiguration(file);
  var utime = y.getString("timestamps.login");
  if(utime != null){
    var t = new java.util.Date(java.lang.Long.parseLong(utime));
    var filename = file.getName();
    var pl = filename.substring(0,filename.length()-4);
    //var f = pl.getFirstPlayed();
    if(t.compareTo(mindate)<0) islive=false;
  }
  homes = y.getConfigurationSection("homes");
  if(homes == null) islive=false;
  if(islive){
    y.set("money","100.0");
    y.save(file);
    liveplayers.println(pl);
  }else{
    file.delete();
    datfile = new File("world/players/"+pl+".dat");
    if(datfile.exists()) datfile.delete();
  }
}
liveplayers.close();
player.print("done");


